/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package fr.irit.etracetool.etrace.impl;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;

import fr.irit.etracetool.etrace.AbstractLink;
import fr.irit.etracetool.etrace.CompositeLink;
import fr.irit.etracetool.etrace.EObjectOrigin;
import fr.irit.etracetool.etrace.ETrace;
import fr.irit.etracetool.etrace.EtraceFactory;
import fr.irit.etracetool.etrace.EtracePackage;
import fr.irit.etracetool.etrace.Link;
import fr.irit.etracetool.etrace.LinkType;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class EtracePackageImpl extends EPackageImpl implements EtracePackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass abstractLinkEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass linkTypeEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass eTraceEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass compositeLinkEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass linkEClass = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EEnum eObjectOriginEEnum = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see fr.irit.etracetool.etrace.EtracePackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private EtracePackageImpl() {
		super(eNS_URI, EtraceFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this
	 * model, and for any others upon which it depends.  Simple
	 * dependencies are satisfied by calling this method on all
	 * dependent packages before doing anything else.  This method drives
	 * initialization for interdependent packages directly, in parallel
	 * with this package, itself.
	 * <p>Of this package and its interdependencies, all packages which
	 * have not yet been registered by their URI values are first created
	 * and registered.  The packages are then initialized in two steps:
	 * meta-model objects for all of the packages are created before any
	 * are initialized, since one package's meta-model objects may refer to
	 * those of another.
	 * <p>Invocation of this method will not affect any packages that have
	 * already been initialized.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static EtracePackage init() {
		if (isInited) return (EtracePackage)EPackage.Registry.INSTANCE.getEPackage(EtracePackage.eNS_URI);

		// Obtain or create and register package
		EtracePackageImpl theEtracePackage = (EtracePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof EtracePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) : new EtracePackageImpl());

		isInited = true;

		// Create package meta-data objects
		theEtracePackage.createPackageContents();

		// Initialize created meta-data
		theEtracePackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theEtracePackage.freeze();

		return theEtracePackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getAbstractLink() {
		return abstractLinkEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getAbstractLink_Source() {
		return (EReference)abstractLinkEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getAbstractLink_Target() {
		return (EReference)abstractLinkEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getAbstractLink_Type() {
		return (EReference)abstractLinkEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getLinkType() {
		return linkTypeEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getLinkType_Description() {
		return (EAttribute)linkTypeEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getLinkType_Purpose() {
		return (EAttribute)linkTypeEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getLinkType_Uses() {
		return (EAttribute)linkTypeEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getLinkType_Example() {
		return (EAttribute)linkTypeEClass.getEStructuralFeatures().get(3);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getLinkType_Name() {
		return (EAttribute)linkTypeEClass.getEStructuralFeatures().get(4);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getLinkType_SubType() {
		return (EReference)linkTypeEClass.getEStructuralFeatures().get(5);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getLinkType_SuperType() {
		return (EReference)linkTypeEClass.getEStructuralFeatures().get(6);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getLinkType_SourceOrigin() {
		return (EAttribute)linkTypeEClass.getEStructuralFeatures().get(7);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getLinkType_TargetOrigin() {
		return (EAttribute)linkTypeEClass.getEStructuralFeatures().get(8);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getETrace() {
		return eTraceEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EAttribute getETrace_Name() {
		return (EAttribute)eTraceEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getETrace_TypeList() {
		return (EReference)eTraceEClass.getEStructuralFeatures().get(1);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getETrace_DeletedElement() {
		return (EReference)eTraceEClass.getEStructuralFeatures().get(2);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getETrace_ExternalElement() {
		return (EReference)eTraceEClass.getEStructuralFeatures().get(3);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getCompositeLink() {
		return compositeLinkEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EReference getCompositeLink_Children() {
		return (EReference)compositeLinkEClass.getEStructuralFeatures().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getLink() {
		return linkEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EEnum getEObjectOrigin() {
		return eObjectOriginEEnum;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EtraceFactory getEtraceFactory() {
		return (EtraceFactory)getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated) return;
		isCreated = true;

		// Create classes and their features
		abstractLinkEClass = createEClass(ABSTRACT_LINK);
		createEReference(abstractLinkEClass, ABSTRACT_LINK__SOURCE);
		createEReference(abstractLinkEClass, ABSTRACT_LINK__TARGET);
		createEReference(abstractLinkEClass, ABSTRACT_LINK__TYPE);

		linkTypeEClass = createEClass(LINK_TYPE);
		createEAttribute(linkTypeEClass, LINK_TYPE__DESCRIPTION);
		createEAttribute(linkTypeEClass, LINK_TYPE__PURPOSE);
		createEAttribute(linkTypeEClass, LINK_TYPE__USES);
		createEAttribute(linkTypeEClass, LINK_TYPE__EXAMPLE);
		createEAttribute(linkTypeEClass, LINK_TYPE__NAME);
		createEReference(linkTypeEClass, LINK_TYPE__SUB_TYPE);
		createEReference(linkTypeEClass, LINK_TYPE__SUPER_TYPE);
		createEAttribute(linkTypeEClass, LINK_TYPE__SOURCE_ORIGIN);
		createEAttribute(linkTypeEClass, LINK_TYPE__TARGET_ORIGIN);

		eTraceEClass = createEClass(ETRACE);
		createEAttribute(eTraceEClass, ETRACE__NAME);
		createEReference(eTraceEClass, ETRACE__TYPE_LIST);
		createEReference(eTraceEClass, ETRACE__DELETED_ELEMENT);
		createEReference(eTraceEClass, ETRACE__EXTERNAL_ELEMENT);

		compositeLinkEClass = createEClass(COMPOSITE_LINK);
		createEReference(compositeLinkEClass, COMPOSITE_LINK__CHILDREN);

		linkEClass = createEClass(LINK);

		// Create enums
		eObjectOriginEEnum = createEEnum(EOBJECT_ORIGIN);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized) return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes
		eTraceEClass.getESuperTypes().add(this.getCompositeLink());
		compositeLinkEClass.getESuperTypes().add(this.getAbstractLink());
		linkEClass.getESuperTypes().add(this.getAbstractLink());

		// Initialize classes and features; add operations and parameters
		initEClass(abstractLinkEClass, AbstractLink.class, "AbstractLink", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getAbstractLink_Source(), ecorePackage.getEObject(), null, "source", null, 0, 1, AbstractLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getAbstractLink_Target(), ecorePackage.getEObject(), null, "target", null, 0, 1, AbstractLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getAbstractLink_Type(), this.getLinkType(), null, "type", null, 1, 1, AbstractLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(linkTypeEClass, LinkType.class, "LinkType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getLinkType_Description(), ecorePackage.getEString(), "description", null, 0, 1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getLinkType_Purpose(), ecorePackage.getEString(), "purpose", null, 0, 1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getLinkType_Uses(), ecorePackage.getEString(), "uses", null, 0, 1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getLinkType_Example(), ecorePackage.getEString(), "example", null, 0, 1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getLinkType_Name(), ecorePackage.getEString(), "name", null, 1, 1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getLinkType_SubType(), this.getLinkType(), this.getLinkType_SuperType(), "subType", null, 0, -1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getLinkType_SuperType(), this.getLinkType(), this.getLinkType_SubType(), "superType", null, 0, 1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getLinkType_SourceOrigin(), this.getEObjectOrigin(), "sourceOrigin", null, 0, 1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEAttribute(getLinkType_TargetOrigin(), this.getEObjectOrigin(), "targetOrigin", null, 0, 1, LinkType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(eTraceEClass, ETrace.class, "ETrace", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEAttribute(getETrace_Name(), ecorePackage.getEString(), "name", null, 0, 1, ETrace.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getETrace_TypeList(), this.getLinkType(), null, "typeList", null, 0, -1, ETrace.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getETrace_DeletedElement(), ecorePackage.getEObject(), null, "deletedElement", null, 0, -1, ETrace.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
		initEReference(getETrace_ExternalElement(), ecorePackage.getEObject(), null, "externalElement", null, 0, -1, ETrace.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		initEClass(compositeLinkEClass, CompositeLink.class, "CompositeLink", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
		initEReference(getCompositeLink_Children(), this.getAbstractLink(), null, "children", null, 0, -1, CompositeLink.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

		addEOperation(compositeLinkEClass, this.getLink(), "createLink", 0, 1, IS_UNIQUE, IS_ORDERED);

		EOperation op = addEOperation(compositeLinkEClass, this.getLink(), "createLink", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEObject(), "source", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, ecorePackage.getEObject(), "target", 0, 1, IS_UNIQUE, IS_ORDERED);
		addEParameter(op, this.getLinkType(), "type", 0, 1, IS_UNIQUE, IS_ORDERED);

		addEOperation(compositeLinkEClass, this.getCompositeLink(), "createCompositeLink", 0, 1, IS_UNIQUE, IS_ORDERED);

		addEOperation(compositeLinkEClass, ecorePackage.getEObject(), "getAllSources", 0, -1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(compositeLinkEClass, ecorePackage.getEObject(), "getAllTargets", 0, -1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(compositeLinkEClass, ecorePackage.getEObject(), "getAllReferencedElements", 0, -1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(compositeLinkEClass, this.getLink(), "getAllLinks", 0, -1, IS_UNIQUE, IS_ORDERED);

		addEOperation(compositeLinkEClass, this.getCompositeLink(), "getAllCompositeLinks", 0, -1, IS_UNIQUE, !IS_ORDERED);

		addEOperation(compositeLinkEClass, ecorePackage.getEInt(), "numberOfLinks", 0, 1, IS_UNIQUE, IS_ORDERED);

		addEOperation(compositeLinkEClass, ecorePackage.getEInt(), "numberOfCompositeLinks", 0, 1, IS_UNIQUE, IS_ORDERED);

		initEClass(linkEClass, Link.class, "Link", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);

		// Initialize enums and add enum literals
		initEEnum(eObjectOriginEEnum, EObjectOrigin.class, "EObjectOrigin");
		addEEnumLiteral(eObjectOriginEEnum, EObjectOrigin.SOURCE);
		addEEnumLiteral(eObjectOriginEEnum, EObjectOrigin.TARGET);
		addEEnumLiteral(eObjectOriginEEnum, EObjectOrigin.INTERMEDIATE);

		// Create resource
		createResource(eNS_URI);
	}

} //EtracePackageImpl
